<template>
	<view class="page">
		<view class="header" :style="{ paddingTop: statusBarHeight + 'px' }">
			<text class="title">我</text>
		</view>
		<view class="content">
			<view class="user-section">
				<image class="avatar" src="/static/logo.png" mode="aspectFill"></image>
				<text class="username">抖阳用户</text>
			</view>
			<view class="menu-list">
				<view class="menu-item" @tap="goToSettings">
					<uni-icons type="gear" size="24" color="#fff"></uni-icons>
					<text class="menu-text">设置</text>
					<uni-icons type="right" size="20" color="#666"></uni-icons>
				</view>
				<view class="menu-item" @tap="goToProfile">
					<uni-icons type="person" size="24" color="#fff"></uni-icons>
					<text class="menu-text">个人资料</text>
					<uni-icons type="right" size="20" color="#666"></uni-icons>
				</view>
			</view>
		</view>
		<BottomTabBar active="me" :badge="0" @change="onTabChange" @publish="onPublish" />
	</view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import BottomTabBar from '@/components/BottomTabBar.vue'

const statusBarHeight = ref(0)
onMounted(() => {
	// #ifdef APP-PLUS || MP
	statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight || 0
	// #endif
})

function onTabChange(key) {
	if (key === 'home') {
		uni.reLaunch({ url: '/pages/index/index' })
	} else if (key === 'friends') {
		uni.reLaunch({ url: '/pages/friends/index' })
	} else if (key === 'message') {
		uni.reLaunch({ url: '/pages/message/index' })
	} else if (key === 'me') {
		// 当前页面，无需切换
	}
}

function onPublish() {
	uni.navigateTo({ 
		url: '/pages/publish/record' 
	})
}

function goToSettings() {
	uni.showToast({ title: '设置功能开发中', icon: 'none' })
}

function goToProfile() {
	uni.showToast({ title: '个人资料功能开发中', icon: 'none' })
}
</script>

<style scoped>
.page {
	width: 100vw;
	height: 100vh;
	background: #000;
	display: flex;
	flex-direction: column;
}

.header {
	padding: 20rpx 30rpx;
	background: rgba(0, 0, 0, 0.8);
}

.title {
	font-size: 36rpx;
	font-weight: 600;
	color: #fff;
}

.content {
	flex: 1;
	overflow-y: auto;
}

.user-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 60rpx 30rpx 40rpx;
	gap: 20rpx;
}

.avatar {
	width: 160rpx;
	height: 160rpx;
	border-radius: 50%;
	border: 4rpx solid rgba(255, 255, 255, 0.2);
}

.username {
	font-size: 32rpx;
	color: #fff;
	font-weight: 500;
}

.menu-list {
	padding: 0 30rpx;
}

.menu-item {
	display: flex;
	align-items: center;
	padding: 30rpx 0;
	border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
	gap: 20rpx;
}

.menu-text {
	flex: 1;
	font-size: 28rpx;
	color: #fff;
}
</style>

